You have now created a way to view and edit the films in your database. However, the ability to see a listing of all the films has been lost. To correct this, you will create a new class, named Film Contents, that displays a list of all the films. You will change Film Catalog so that it can display Film Contents, and add a button to turn to Film Contents.
• Create a new class named Film Contents.
• Change its aligner to be 1 x 1.
• Insert a list into the aligner.
• Edit the script for the list to read:
return film-folder.list.
The list will display all the films. Now, change the response clicking on a film to change the index in Film Catalog to that of the film that is clicked on.
• Command-click on the list, choose Edit List Commands from the List section of the pop-up menu.
• Click on the Select menu entry (#6110).
• Click the Edit Script button and override the default script.
• Edit the script to read.
$ item i, display d.
film-catalog.index := i.
If you switch Film Contents to user mode, you can use it as is to select which film should be displayed in the Film Catalog. The next step, however, is to integrate Film Contents with the Film Catalog.
Integrating the table of contents
Next you will change the morph view in Film Catalog so that it displays Film Contents when the catalog’s index is 0. Make sure Film Catalog is in author mode before proceeding.
• Command-click in the morph view in the bottom part of Film Catalog.
• Select Edit Script from the pop-up menu.
• Edit the script to read:
if index == 0
then [ return film-contents ].
return film-folder-list @ index.
Now, add a button to Film Catalog to set the index to 0.
• Insert a new button named Contents in the lower left row of the top aligner in Film Contents.
• Edit the script for the button to read:
index := 0.
Installing the Film Catalog as the main view
• Close all floating windows except Film Catalog.
• Command-click in Film Catalog’s title bar.
• Select Make Main Win in the View category from the pop-up.
From now on, when you open the document, the Film Catalog will be displayed.
 
Congratulations!!
You have built your first application in Codeworks! Good luck experimenting with the environment and building you own custom applications.
For more information on building and manipulating object in the user interface, see the Codeworks Procedures Manual. For more information about the Glyphic Script language itself, see the Codeworks Scripting Manual.